package com.heima.leadnews.wemedia.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.leadnews.wemedia.mapper.WmChannelMapper;
import com.heima.leadnews.wemedia.service.WmChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojo.WmChannel;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 频道信息表 服务实现类
 * </p>
 *
 * @author author
 * @since 2023-06-03
 */
@Service
public class WmChannelServiceImpl extends ServiceImpl<WmChannelMapper, WmChannel> implements WmChannelService {

    @Override
    public ResponseResult<List<WmChannel>> channels() {
        LambdaQueryWrapper<WmChannel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WmChannel::getStatus,WmChannel.Status.ENABLE);
        queryWrapper.orderByAsc(WmChannel::getOrd);
        List<WmChannel> list = list(queryWrapper);
        return ResponseResult.okResult(list);
    }
}
